package cn.zc.curriculum.service.controller.admin;

import cn.tools.core.VO.PageVO;
import cn.tools.core.base.R;
import cn.zc.curriculum.entity.Dto.CurriculumClassifyDto;
import cn.zc.curriculum.entity.VO.CurriculumClassifyVO;
import cn.zc.curriculum.service.service.CurriculumClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "后台课程管理接口")
@RestController
@RequestMapping("/curriculum")
public class AdminCurriculumClassifyController {



    @Resource
    private CurriculumClassifyService curriculumClassifyService;


    @ApiOperation(value = "查询课程")
    @GetMapping("/admin/find/CurriculumClassify")
    private R<Object> findCurriculumClassify(PageVO pageVO, CurriculumClassifyVO curriculumClassifyVO){

        CurriculumClassifyDto[] curriculumClassify = curriculumClassifyService.findCurriculumClassify(pageVO,curriculumClassifyVO);
        return R.success(curriculumClassify);
    }

    /**
     * 创建课程
     * @param curriculumClassifyDto
     * @return
     */
    @ApiOperation(value = "创建课程接口")
    @PostMapping("/admin/create/CurriculumClassify")
    private R createCurriculumClassify(@RequestBody CurriculumClassifyDto curriculumClassifyDto){
        curriculumClassifyService.createCurriculumClassify(curriculumClassifyDto);
        return R.success();
    }


    /**
     * 修改课程
     * @param curriculumClassifyDto
     * @return
     */
    @ApiOperation(value = "修改课程")
    @PutMapping("/admin/update/CurriculumClassify")
    private R updateCurriculumClassify(@RequestBody CurriculumClassifyDto curriculumClassifyDto){
        curriculumClassifyService.updateCurriculumClassify(curriculumClassifyDto);
        return R.success();
    }


    /**
     * 删除课程
     * @param id
     * @return
     */
    @ApiOperation(value = "删除课程")
    @DeleteMapping("/admin/delete/CurriculumClassify")
    private R deleteCurriculumClassify(String id){
        curriculumClassifyService.deleteCurriculumClassify(id);
        return R.success();
    }

}
